package com.hzlj.position.locate.controller;


import com.fz.common.base.dto.PageParamDTO;
import com.fz.common.base.dto.QueryPageResultDTO;
import com.fz.common.base.dto.ResultDTO;
import com.fz.common.base.office.EasyExcelUtil;
import com.hzlj.position.locate.common.dto.reportInspectionArtificial.ReportInspectionArtificialQueryParamDTO;
import com.hzlj.position.locate.common.dto.reportInspectionArtificial.ReportInspectionArtificialWithJzJbxxDTO;
import com.hzlj.position.locate.service.ReportInspectionArtificialService;
import com.hzlj.sqjz.system.service.JgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * 【通信联络核查-核查-最新】接口
 *
 * @author lifh
 * @date 2023-08-04 17:37:51
 */
@Slf4j
@RestController
@RequestMapping("/position/report/inspection/artificial")
public class ReportInspectionArtificialController {
    @Resource
    private JgService jgService;
    @Resource
    private ReportInspectionArtificialService reportInspectionArtificialService;
    

    /**
     * 列表查询 通信联络核查-核查-最新
     */
    @GetMapping("/list")
    public ResultDTO<List<ReportInspectionArtificialWithJzJbxxDTO>> listReportInspectionArtificial(ReportInspectionArtificialQueryParamDTO dto){
        log.debug("【查询无分页列表】信息通信联络核查-核查-最新,ReportInspectionArtificialQueryParamDTO={}",dto);
        return new ResultDTO<>(reportInspectionArtificialService.listReportInspectionArtificial(dto));
    }
   
    /**
     * 分页查询 通信联络核查-核查-最新
     */
     @GetMapping("/list/page")
    public ResultDTO<QueryPageResultDTO<ReportInspectionArtificialWithJzJbxxDTO>>  pageReportInspectionArtificial(ReportInspectionArtificialQueryParamDTO dto,PageParamDTO pageParamDTO){
        log.debug("【查询分页列表】信息通信联络核查-核查-最新,ReportInspectionArtificialQueryParamDTO={},pageParamDTO={}",dto,pageParamDTO);
        return new ResultDTO<>(reportInspectionArtificialService.pageReportInspectionArtificial(dto,pageParamDTO));
    }



    /**
     * 导出 通信联络核查-人工核验
     */
    @GetMapping("/export")
    public void exportArtificial(HttpServletResponse response,
                                 ReportInspectionArtificialQueryParamDTO dto) {
        List<ReportInspectionArtificialWithJzJbxxDTO> list = reportInspectionArtificialService.listReportInspectionArtificial(dto);
        EasyExcelUtil.downCustomerExcel(response,
                "人工核查记录",
                "人工核查记录",
                jgService.export3Level(ReportInspectionArtificialWithJzJbxxDTO::getJgCode, ReportInspectionArtificialWithJzJbxxDTO::getJgMc)
                        .add(ReportInspectionArtificialWithJzJbxxDTO::getXm, "姓名")
                        .add(ReportInspectionArtificialWithJzJbxxDTO::getXbText, "性别")
                        .add(ReportInspectionArtificialWithJzJbxxDTO::getSjh, "手机号")
                        .add(ReportInspectionArtificialWithJzJbxxDTO::getSpotCheckTime, "最近核查时间")
                        .add(ReportInspectionArtificialWithJzJbxxDTO::getReportStatusText, "当前状态")
                        .add(ReportInspectionArtificialWithJzJbxxDTO::getNoticeText, "核查状态")
                        .getFields(),
                list
        );
    }

}

